package com.dzqc.fly.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

@Configuration
public class ImagesUploadConfig implements WebMvcConfigurer {
        public void addResourceHandlers(ResourceHandlerRegistry registry) {

        String path = "src\\main\\resources\\static\\upload\\";
        File fileDir = new File(path);
        registry.addResourceHandler("/images/**").addResourceLocations("file:"+fileDir.getAbsolutePath());
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
    }
}
